package demo_File;

import java.util.*;
import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rei
 * Date: 2025-11-25
 * Time: 15:15
 */
public class Test {
    public static void main2(String[] args) throws IOException{
        File file = new File("abac.txt");
        System.out.println(file.getCanonicalFile());
        //file.createNewFile();



        //返回 File 对象代表的⽬录下的所有⽂件，以 File 对象表⽰



    }
    public static void main1(String[] args) throws IOException {
        File file = new File("c:/temp");
        //file.mkdir();

        System.out.println(file.exists());
        File file1 = new File("test.text");
        System.out.println(file1.getAbsoluteFile()); //绝对路径
        System.out.println(file1.getCanonicalFile());

        System.out.println("==========================");

        File file2 = new File("./test.text");
        System.out.println(file2.getAbsoluteFile()); //绝对路径
        System.out.println(file2.getCanonicalFile());  //一般用这个

        System.out.println(file1.isDirectory());
    }
}
